# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django import forms
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST
from django.core.paginator import Paginator
from django.contrib.localflavor import pe
from django.db.models import Count
import os
from django.contrib.auth.decorators import login_required
from doc_trans.models import *


def index(request):
    project_objects = Project.objects.filter(suspended = False, versions__isnull = False).distinct().order_by('name')[:10]

    translators = User.objects.annotate(num_translations=Count('translations')).order_by('-num_translations').filter(num_translations__gt = 0)[:10]
    
    return render_to_response('main/index.html',locals(), context_instance = RequestContext(request))
    